<template>
  <div>
    <el-tabs v-model="activeName" @tab-click="handleClick" class="tabs-two">
      <el-tab-pane label="资源监控" name="1" />
      <el-tab-pane label="日志" name="2" />
    </el-tabs>

    <!--<log-active :active="activeName" v-if="detail.status == 'running'" />-->
    <log-active :active="activeName" />
  </div>
</template>
  
<script>
import logActive from './module/log-active.vue'
export default {
  data() {
    return {
      activeName: '1',
      showFilter: false,
      checkAll: false,
      checkedtarget: ['上海', '北京'],
      target: [],
      isIndeterminate: true,
      detail: {}
    };
  },
  props: ['detailData'],
  watch: {
    detailData(val) {
      this.detail = val
    }
  },
  async mounted() {
    this.$nextTick(async () => {
      this.detail = this.detailData;
      await this.getData()
      this.handleFilterStorage()
    })
  },
  components: {
    logActive
  },
  methods: {
    handleClick() { },
    async getData() {
      await new Promise(resolve => {
        setTimeout(() => {
          this.target = ['上海', '北京', '广州', '深圳']
          resolve()
        }, 1000)
      })
      return
    },
    onClose() {
      this.showFilter = false
    },
    handleCheckAllChange(val) {
      this.checkedtarget = val ? this.target : [];
      this.isIndeterminate = false;
    },
    handleCheckedtargetChange(value) {
      let checkedCount = value.length;
      this.checkAll = checkedCount === this.target.length;
      this.isIndeterminate = checkedCount > 0 && checkedCount < this.target.length;
    },
    handleFilterStorage() {
      let thisTarget = null
      let targetStorage = localStorage.getItem('targetStorage') ? JSON.parse(localStorage.getItem('targetStorage')) : null
      if (targetStorage) {
        thisTarget = targetStorage[this.$route.query.id]
      } else {
        localStorage.setItem('targetStorage', JSON.stringify({}))
      }
      console.log(thisTarget)
    }
  }
}
</script>

<style lang="less" scoped></style>